package com.xjrsoft.common.serializers;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import lombok.extern.slf4j.Slf4j;
import oracle.sql.NCLOB;

import java.io.IOException;
import java.sql.SQLException;

@Slf4j
public class NClobSerializer  extends JsonSerializer<NCLOB> {
    @Override
    public void serialize(NCLOB value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
        try {
            gen.writeString(value.stringValue());
        } catch (SQLException e) {
            log.error("NCLOB类型数据序列化失败！", e);
        }
    }
}
